﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.ServiceModel.Channels;
using OnlineGameLibrary.MessageEx;

namespace OnlineGameLibrary.Activities
{

    public sealed class MessageWrite : CodeActivity<Message>
    {
        [RequiredArgument]
        public InArgument<MessageDefine> Define { get; set; }

        public InArgument<object> MessageBody { set; get; }

        public InArgument<IList<string>> Audience { set; get; }

        protected override Message Execute(CodeActivityContext context)
        {
            var define = Define.Get(context);
            var msgbody = MessageBody.Get(context);
            var aud = Audience.Get(context);

            return define.CreateMessage(msgbody).SetAudience(aud);
        }
    }
}
